<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>年级</title>
	<link rel="stylesheet" href="../css/layui.css">
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="../css/item.css">
	<style>
		.layui-row {
			margin-top: 50px;
		}
	</style>
</head>

<body>

	<form class="layui-form">
		<div class="layui-row" id="vue-root">
			<div class="layui-col-md6 layui-col-md-offset3">
				<div class="layui-form-item">
					<label class="layui-form-label" v-t="'年级名称'"></label>
					<div class="layui-input-block">
						<input name="gradeName" v-validate="'required'" :data-vv-as="$t('年级名称')" autocomplete="off"
							:placeholder="$t('请输入')+$t('年级名称')" class="layui-input gradename" v-model="item.name">
						<div class="checkout_state" v-text="err('gradeName')">
						</div>
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label" v-t="'年级主任'"></label>
					<div class="layui-input-block">
						<select name="teacherName" :data-vv-as="$t('年级主任')" class="input_select classteacher"
							id="teacher" v-model="item.teacherId">
							<option :value="undefined" disabled="disabled">{{$t('请选择')+$t('年级主任')}}</option>
							<option v-for="teacher in teachers" :key="teacher.id" :value="teacher.id"
								v-text="teacher.name">
							</option>
						</select>
						<div class="checkout_state" v-text="err('teacherName')"></div>
					</div>
				</div>

				<div class="layui-form-item">
					<div class="layui-input-block">
						<div class="offer" @click="submit" v-t="'立即提交'"></div>
						<div class="return" onclick="history.back()" v-t="'取消'"></div>
					</div>
				</div>
			</div>
		</div>
	</form>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>
	<script src="/js/i18n.js"></script>

	<script>

		setI18n({
			立即提交: 'submit',
			取消: 'cancel',
			请输入: 'Please enter ',
			请选择: 'Please choose ',
			年级名称: 'Grade name',
			年级主任: 'Grade Director'
		});

		var app = new Vue(merge({
			data: {
				item: {
					schoolId: top_params().id
				},
				url: '/pc/grade',
				teachers: []
			},
			created: function () {
				axios.get('/pc/teacher/all/' + this.item.schoolId).then(function (res) {
					this.teachers = res.data;
				}.bind(this));

				this.init();
			},
			i18n: i18n
		}));
	</script>

</body>

</html>